<template>
  <div class="m-img">
    <el-image
      v-bind="$attrs"
      v-on="$listeners"
      :src='computedUrl'
    />
  </div>
</template>
<script>
const STATIC_ORIGIN = 'https://m.met-ec.com/m-static-resource/m-img'
export default {
  name: 'MImg',
  props: {
    type: {
      type: String,
      default: ''
    },
    name: {
      type: String,
      default: ''
    },
    path: {
      type: String,
      default: ''
    }
  },
  computed: {
    computedUrl () {
      if (this.path) return this.path
      return `${STATIC_ORIGIN}/${this.type}/${this.name}`
    }
  }
}
</script>
